import apiUrl from '../base'
import axios from '@/libs/axios'
const ProjectPerson = {
  //获取项目树
  getOrgTree() {
    return axios.post(`${apiUrl.base}v1/OrgTree/tree/project/`)
  },
  //获取项目树
  getEntTree() {
    return axios.post(`${apiUrl.base}v1/OrgTree/tree/enterprise/`)
  },
  //获取人员列表
  getProPersonList(data) {
    return axios.post(`${apiUrl.base}v1/ProjectPerson/list`,data)
  },
  //获取机构人员列表
  getEntPersonList(data) {
    return axios.post(`${apiUrl.base}v1/EnterprisePerson/list`,data)
  },
  //根据CODE获取字典
  getListByTypeCode(data){
    return axios.get(`${apiUrl.base}v1/Dict/getListByTypeCode/`+data)
  },
  //获取职务类型
  getJobList(data){
    return axios.post(`${apiUrl.base}v1/Post/queryListByEnterpriseId`,data)
  },
  //获取项目详情
  getDetail(id){
    return axios.get(`${apiUrl.base}v1/Project/detail/`+id)
  },
  //获取初始化角色
  getBasicInfo(id){
    return axios.get(`${apiUrl.base}v1/ProjectPerson/basicInfo/`+id)
  },
  //选择人员获取机构树
  getEnterpriseTree(){
    return axios.post(`${apiUrl.base}v1/OrgTree/tree/enterpriseFromTop`)
  },
  //选择人员获取项目树
  getProjectTree(){
    return axios.post(`${apiUrl.base}v1/OrgTree/tree/projectFromTop`)
  },
  //获取人员详情
  getPersonDetail(id){
    return axios.get(`${apiUrl.base}v1/ProjectPerson/detail/`+id)
  },
  //获取人员详情
  getNewDetail(deptId,id){
    return axios.get(`${apiUrl.base}v1/EnterprisePerson/newBasicInfo/`+deptId+`/`+id)
  },
  //获取人员编号
  getPersonCode(data){
    return axios.get(`${apiUrl.base}v1/ProjectPerson/getNumber/`+data)
  },
  //添加人员
  addPerson(data){
    return axios.post(`${apiUrl.base}v1/ProjectPerson/add`,data)
  },
  //添加机构人员
  addEnterprisePerson(data){
    return axios.post(`${apiUrl.base}v1/EnterprisePerson/add`,data)
  },
  //编辑机构人员
  editEnterprisePerson(data){
    return axios.post(`${apiUrl.base}v1/EnterprisePerson/edit`,data)
  },
  //编辑人员
  editPerson(data){
    return axios.post(`${apiUrl.base}v1/ProjectPerson/edit`,data)
  },
  //人员进场
  checkIn(data){
    return axios.post(`${apiUrl.base}v1/EnterprisePerson/checkIn`,data)
  },
  //人员离场
  checkOut(data){
    return axios.post(`${apiUrl.base}v1/EnterprisePerson/checkOut`,data)
  },
  //人员删除
  onePersonDelete(id){
    return axios.request({
      url: `${apiUrl.base}v1/ProjectPerson/delete/`+id,
      method: 'delete',
    })
  },
  //人员批量删除
  personDelete(data){
    return axios.request({
      url: `${apiUrl.base}v1/ProjectPerson/batchDelete`,
      data,
      method: 'delete',
    })
  },
  //人员机构删除
  oneEnterprisePersonDelete(id){
    return axios.request({
      url: `${apiUrl.base}v1/EnterprisePerson/delete/`+id,
      method: 'delete',
    })
  },
  //获取用户角色
  availableRoles(id){
    return axios.get(`${apiUrl.base}v1/EnterprisePerson/availableRoles/`+id)
  },
  //生成用户
  genUser(data){
    return axios.post(`${apiUrl.base}v1/EnterprisePerson/genUser/`,data)
  }
};
export default ProjectPerson
